﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyTest {

    /// <summary>
    /// 
    /// </summary>
    public class SelectOption : IElement {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="findBy">HTML text to identify and find elements within a document.</param>
        public SelectOption(string findBy):this(findBy,null,null) {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="findBy">HTML text to identify and find elements within a document.</param>
        /// <param name="focus">Document container with controls to search for.</param>
        public SelectOption(string findBy, Focus focus)
            : this(findBy,null,focus) {}

        /// <summary>
        /// 
        /// </summary>
        /// <param name="findBy">HTML text to identify and find elements within a document.</param>
        /// <param name="parentElement"></param>
        /// <param name="focus">Document container with controls to search for.</param>
        public SelectOption(string findBy, IElement parentElement, Focus focus)
        {
            FindBy = findBy;
            Focus = focus;
            ParentElement = parentElement;
        }

        /// <summary>
        /// 
        /// </summary>
        public void Set() {
            GoTo();
            Action.Click(FindBy);
        }
        public bool IsReadOnly()
        {
            GoTo();
            return Action.IsReadOnly(FindBy);
        }

        public virtual string GetValue()
        {
            GoTo();
            return Action.GetValue(FindBy);
        }
        public void VerifyExists()
        {
            GoTo();
            Action.Verify.Exists(FindBy);
        }
    }

}
